<?php session_start(); ob_start();
	require_once('connect.php');
	require_once('calendar/classes/tc_calendar.php');

	$id_hotel=$_GET['id'];
?>
<!DOCTYPE html>
<html lang="en">

<head>
<link rel="shortcut icon" href="images/favicon.php" />
<meta charset="UTF-8" />
<meta name="robots" content="index, follow" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<title>Indonesian Hotel</title>
<!-- ////////////////////////////////// -->
<!-- //      Start Stylesheets       // -->
<!-- ////////////////////////////////// -->
<link href="styles/style.css" rel="stylesheet" type="text/css" />
<link href="styles/color.css" rel="stylesheet" type="text/css" />
<link href="styles/inner.css" rel="stylesheet" type="text/css" />
<link href="calendar/calendar.css" rel="stylesheet" type="text/css" />


<!-- ////////////////////////////////// -->
<!-- //      Javascript Files        // -->
<!-- ////////////////////////////////// -->
<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="js/hoverIntent.js"></script> 
<script type="text/javascript" src="js/superfish.js"></script> 
<script type="text/javascript" src="js/supersubs.js"></script>
<script language="javascript" src="calendar/calendar.js"></script>


<script type="text/javascript">
jQuery(document).ready(function(){

	//Menu
	jQuery("ul.sf-menu").supersubs({ 
	minWidth		: 12,		// requires em unit.
	maxWidth		: 14,		// requires em unit.
	extraWidth		: 3	// extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values
						   // due to slight rounding differences and font-family 
	}).superfish();  // call supersubs first, then superfish, so that subs are 
					 // not display:none when measuring. Call before initialising 
					 // containing tabs for same reason. 
					 
});
</script>
</head>
<body>

<div id="outer-container">
		
        <div id="wrapper-header">
        <div class="container">
            <div id="header">
                <div id="logo">
                	<span class="logo-l"></span>
                    <a href="index.php"><img src="images/logo2.png" alt=""  /></a>
                    <span></span>
                </div><!-- end logo -->
                <div class="clear"></div>
                
                <div id="nav-container">
                <div id="nav-main">
                    <div id="nav">
                        <ul id="topnav" class="sf-menu">
                            <li><a href="index.php">Home</a></li>
                            <li><a href="#" >Rooms</a>
                                <ul>
                                    <li><a href="room.php?id=1">Indonesian Hotels 1</a></li>
                                    <li><a href="room.php?id=2">Indonesian Hotels 2</a></li>
                                    <li><a href="room.php?id=3">Indonesian Hotels 3</a></li>
                                    <li><a href="room.php?id=4">Indonesian Hotels 4</a></li>
                                    <li><a href="room.php?id=5">Indonesian Hotels 5</a></li>
                                    <li><a href="room.php?id=6">Indonesian Hotels 6</a></li>
                                    <li><a href="room.php?id=7">Indonesian Hotels 7</a></li>
                                    
                                </ul>
                            </li>
                            <li><a href="reservation.php"  class="current">Reservations</a>
                                <ul>
                                    <li><a href="reservation.php?id=1">Indonesian Hotels 1</a></li>
                                    <li><a href="reservation.php?id=2">Indonesian Hotels 2</a></li>
                                    <li><a href="reservation.php?id=3">Indonesian Hotels 3</a></li>
                                    <li><a href="reservation.php?id=4">Indonesian Hotels 4</a></li>
                                    <li><a href="reservation.php?id=5">Indonesian Hotels 5</a></li>
                                    <li><a href="reservation.php?id=6">Indonesian Hotels 6</a></li>
                                    <li><a href="reservation.php?id=7">Indonesian Hotels 7</a></li>
                                </ul>
							</li>
                            <li><a href="facilities.php">Facilities</a></li>
                            <li><a href="gallery.php">Gallery</a></li>                 
                            <li><a href="about.php">About</a></li>                 
							<li><a href="contact.php">Contact</a></li>
                        </ul><!-- end topnav -->
                    </div><!-- end nav -->	
                </div><!-- end nav-main -->
                </div><!-- end nav-container -->
            </div><!-- end header -->

        </div><!-- end container -->
		</div><!-- end wrapper-header -->  
        
        <div id="wrapper-content">
        <div class="container">
			<div id="content">
        	<div id="main">
            	<div id="maincontent" class="positionleft">
                    <h1><?php echo "Indonesian Hotel ".$id_hotel;?></h1>
                    <div class="tabcontainer">
                        <div id="tab-body">
                        <div id="tab0" class="tab-content">
                          <div id="contactform">
							<h2>Room Reservation</h2>
							<br>
                              <form id="contact" action="<?php echo $PHP_SELF;?>" method="post">
                                <fieldset>
                                    <label for="cekin" id="name_label">Check-in<span class="red">*</span></label>
                                    <?php
									  $myCalendar = new tc_calendar("cekin", true);
									  $myCalendar->setIcon("calendar/images/date.png");
									  $myCalendar->setDate(date('d'), date('m'), date('Y'));
									  $myCalendar->setPath("calendar/");
									  $myCalendar->setYearInterval(1960, 2015);
									  $myCalendar->dateAllow('2010-01-01', '2015-03-01');
									  //$myCalendar->setHeight(350);
									  //$myCalendar->autoSubmit(true, "form1");
									  $myCalendar->setSpecificDate(array("2011-04-01", "2011-04-13", "2011-04-25"), 0, 'month');
									  $myCalendar->setOnChange("myChanged('test')");
									  //$myCalendar->rtl = true;
									  $myCalendar->writeScript();
									  ?></br></br>
                                    <label for="cekout" id="email_label">Check-out<span class="red">*</span></label>
									<?php
									  $myCalendar = new tc_calendar("cekout", true);
									  $myCalendar->setIcon("calendar/images/date.png");
									  $myCalendar->setDate(date('d+1'), date('m'), date('Y'));
									  $myCalendar->setPath("calendar/");
									  $myCalendar->setYearInterval(1960, 2015);
									  $myCalendar->dateAllow('2010-01-01', '2015-03-01');
									  //$myCalendar->setHeight(350);
									  //$myCalendar->autoSubmit(true, "form1");
									  $myCalendar->setSpecificDate(array("2011-04-01", "2011-04-13", "2011-04-25"), 0, 'month');
									  $myCalendar->setOnChange("myChanged('test')");
									  //$myCalendar->rtl = true;
									  $myCalendar->writeScript();
									?></br></br>
                                    <label for="qty_org" id="phone_label">Occupants per room</label>
                                    <select name="qty_org">
									<?php
									for($i=1;$i<=4;$i++){
										echo "<option value=$i>$i</option>";
									}
									?>
									</select>
									</br>
									</br>
                                    <label for="numroom" id="subject_label">Number of rooms</label>
                                    <select name="qty_room">
									<?php
									for($i=1;$i<=10;$i++){
										echo "<option value=$i>$i</option>";
									}
									?>
									</select>
									</br></br>
									<input type="hidden" name="id_hotel" id="id_hotel" value="<?php echo $id_hotel;?>"/>
									<input type="submit" name="submit" class="button" id="submit_btn" value="Check Availability"/><br />
                                </fieldset>
                              </form>
                        </div><!-- end #contactform -->	
                        </div>
                        </div>
                    </div>
          	<div class="separator line"></div>
                    
                <div class="clear"></div><!-- clear float --> 
                </div><!-- end maincontent -->
                
				<div id="sidebar">
                    <ul>
						<li class="widget-container">
                            <form action="#" id="searchform" method="get">
                                <div class="bgsearch">
                                    <input type="text" onBlur="if (this.value == '')this.value = 'To search type and hit enter';" onFocus="if (this.value == 'To search type and hit enter')this.value = '';" value="To search type and hit enter" id="s" name="s">
                                </div>
                            </form>
                        </li>
						<li class="widget-container">
                            <h2 class="widget-title">Categories</h2>
                            <ul>
                                <li><a href="#">Photogprahy</a></li>
                                <li><a href="#">Website Design</a></li>
                                <li><a href="#">Wordpress</a></li>
                                <li><a href="#">Site Templates</a></li>
                                <li><a href="#">Joomla</a></li>
                            </ul>
                        </li>
						<li class="widget-container">
                            <h2 class="widget-title">Text Widget</h2>
							<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque habitant morbi tristique </p>
                        </li>

                    </ul>
                    <div class="clear"></div><!-- clear float --> 
				</div><!-- end sidebar -->
				<div class="clear"></div><!-- clear float --> 
            </div><!-- end main -->
		</div><!-- end content -->
        </div><!-- end container -->
		</div><!-- end wrapper-content -->
<?php
	include_once "footer.php";
	
	
	$cekin=isset($_REQUEST["cekin"]) ? $_REQUEST["cekin"] : "";
	$cekout=isset($_REQUEST["cekout"]) ? $_REQUEST["cekout"] : "";
	$qty_org=$_POST['qty_org'];
	$qty_room=$_POST['qty_room'];
	$id_hotel=$_POST['id_hotel'];
	
	
	$today = strtotime(date("Y-m-d"));
	$year_cekin=(int)substr($cekin,0,4);
	$month_cekin=(int)substr($cekin,5,2);
	$day_cekin=(int)substr($cekin,8,2);
	$year_cekout=(int)substr($cekout,0,4);
	$month_cekout=(int)substr($cekout,5,2);
	$day_cekout=(int)substr($cekout,8,2);
	$date_cekin = strtotime($cekin);
	$date_cekout = strtotime($cekout);

if($cekin!='' AND $cekout!=''){
		if($date_cekout>$date_cekin AND $date_cekin>=$today){
		
			$_SESSION['id_hotel']=$id_hotel;
			$_SESSION['cekin']=$cekin;
			$_SESSION['cekout']=$cekout;
			$_SESSION['qty_org']=$qty_org;
			$_SESSION['qty_room']=$qty_room;
			
			header('Location:display_room.php');
		}	else
			{?>
			<script language="javascript">
			alert( "check-in value must be greater equal today and check-out value must be greater than check-in");
			</script>
<?php
			}

	}

?>	

